import wyRequest from '../index'
import { Iaccount, IDataType, ILoginResult } from './type'
enum LoginApi {
  AccountLogin = '/login',
  LoginUserInfo = '/users/',
  LoginMenu = '/role/'
}
//账号登录请求
export function accountLoginRequest(account: Iaccount) {
  return wyRequest.post<IDataType<ILoginResult>>({
    url: LoginApi.AccountLogin,
    data: account
  })
}
//根据id获取用户的请求信息
export function requestUserInfoById(id: number) {
  return wyRequest.get<IDataType>({
    url: LoginApi.LoginUserInfo + id,
    showLoading: false
  })
}
//根据用户的id获取不同的菜单
export function requestMenuByid(id: number) {
  return wyRequest.get<IDataType>({
    url: LoginApi.LoginMenu + id + '/menu',
    showLoading: false
  })
}
